package com.maud.retail;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.app.LocalActivityManager;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.maud.retail.RetailHuiZong.AwesomeAdapter;
import com.qizer.R;

public class RetailDetail extends Activity {
	private TextView txtCommodityName,txtSum;
	
	private ViewPager awesomePager;
	private Context cxt;
	private AwesomeAdapter awesomeAdapter;
	private LayoutInflater mInflater;
	private List<View> mListViews;
	private LocalActivityManager manager = null;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.retail_detail);
		txtCommodityName=(TextView)findViewById(R.id.retail_detail_name);
		txtSum=(TextView)findViewById(R.id.retail_detail_sum);
		Intent intent =getIntent();
		txtCommodityName.setText(intent.getStringExtra("name"));
		txtSum.setText(intent.getStringExtra("sum"));
		cxt = this;
		manager = new LocalActivityManager(this, true);
		manager.dispatchCreate(savedInstanceState);
		awesomeAdapter = new AwesomeAdapter();
		awesomePager = (ViewPager) findViewById(R.id.awesomepager2);
		awesomePager.setAdapter(awesomeAdapter);

		mListViews = new ArrayList<View>();
		mInflater = getLayoutInflater();
		
		 
	}
	 

	class AwesomeAdapter extends PagerAdapter {

		@Override
		public void destroyItem(View container, int position, Object object) {
			((ViewPager) container).removeView(mListViews.get(position));
		}

		@Override
		public Object instantiateItem(View container, int position) {
			((ViewPager) container).addView(mListViews.get(position), 0);
			return mListViews.get(position);
		}

		@Override
		public int getCount() {
			return mListViews.size();
		}

		@Override
		public boolean isViewFromObject(View arg0, Object arg1) {
			return arg0 == (arg1);
		}

	}

}
